<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>正则表达式</title>
</head>
<script>
    /*


     */
    var reg=new RegExp("^\\w{6,12}$");
    var reg2= /^\w{6,12}$/
    var name="wangyong"
    var flag=reg.test(name)
    alert(flag)
</script>
<body>


</body>
</html>